package inge_soft.gestoriusNuevo.persistence.DAO.implementation;

import inge_soft.gestoriusNuevo.persistence.DAO.Exceptions.Abstraction.GestoriusException;
import inge_soft.gestoriusNuevo.persistence.DAO.abstraction.ITipoDocumentoDAO;
import inge_soft.gestoriusNuevo.persistence.entity.implementation.TipoDocumento;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Repository("tipoDocumentoDAO")
public class TipoDocumentoDAO implements ITipoDocumentoDAO {

	@PersistenceContext
	private EntityManager entityManager;
	
	@SuppressWarnings("unchecked")
	@Transactional(readOnly = true)
	public List<TipoDocumento> obtenerTodosOrdenadosPorNombreAscendente() {
		return entityManager.createQuery("SELECT t FROM TipoDocumento t ORDER BY t.nombre ASC").getResultList();
	}

	@Transactional(propagation = Propagation.MANDATORY)
	public void crear(TipoDocumento tipoDocumento) throws GestoriusException {
		// TODO Auto-generated method stub
		
	}

	@Transactional(propagation = Propagation.MANDATORY)
	public void modificar(TipoDocumento tipoDocumento) throws GestoriusException {
		// TODO Auto-generated method stub
		
	}

	@Transactional(propagation = Propagation.MANDATORY)
	public void eliminar(TipoDocumento tipoDocumento) throws GestoriusException {
		// TODO Auto-generated method stub
		
	}

}
